package pojo;

import java.nio.ByteBuffer;

/**
 * @CreatedBy richInfo AI
 * @ClassName AA
 * @Date 2021/8/19 6:05 下午
 * @Author xin.yang
 * @Description TODO
 */
public class AA
{

    public static void main(String[] args)
    {
        ByteBuffer byteBuffer = ByteBuffer.allocate(10);
        byteBuffer.put("abc".getBytes());

//        byteBuffer.limit(byteBuffer.position());
//        byteBuffer.position(0);
//        while (byteBuffer.position() < byteBuffer.limit())
//        {
//            System.out.println(byteBuffer.get());
//        }

        byteBuffer.flip();
        while (byteBuffer.hasRemaining())
        {
            System.out.println(byteBuffer.get());
        }
    }
}
